package com.example.controllers;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;

import com.example.dtos.ItemToPurchaseDTO;
import com.example.models.ItemToPurchase;
import com.example.services.ItemToPurchaseService;

@RestController
@RequestMapping("/items")
public class ItemToPurchaseController {
	@Autowired
	ItemToPurchaseService itemToPurchaseService;
	
	 
	 @RequestMapping(value = "/{itemId}/checkout", method = RequestMethod.POST)
	 @ResponseStatus(value= HttpStatus.OK)
	 public void checkout(@PathVariable String itemId) throws Exception{
		itemToPurchaseService.checkout(itemId);
	  }
}
